package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.domain.AjaxResult;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.dto.NursingProjectDto;
import com.zzyl.serve.domain.NursingProject;
import com.zzyl.serve.service.INursingProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/member/orders")
@Api("小程序查询护理项目相关")
public class MemberNursingProjectController {
    @Autowired
    private INursingProjectService nursingProjectService;

    /**
     * 分页查询护理项目
     * @param dto
     * @return
     */
    @GetMapping("/project/page")
    @ApiOperation("分页查询护理项目")
    public TableDataInfo<List<NursingProject>> queryNursingProjectPage(NursingProjectDto dto) {
        TableDataInfo tableDataInfo = nursingProjectService.queryNursingProjectPage(dto);
        return tableDataInfo;
    }

    /**
     * 根据id查询护理项目详情
     * @param id
     * @return
     */
    @GetMapping("/project/{id}")
    @ApiOperation("查询护理项目详情")
    public AjaxResult selectNursingProjectById(@PathVariable Long id) {
        NursingProject nursingProject = nursingProjectService.selectNursingProjectById(id);
        return AjaxResult.success(nursingProject);
    }
}
